package com.zch.socket.aio.client2;

import org.junit.Test;

import java.util.Scanner;
import java.util.concurrent.*;

public class ClientStart {
    Executor threadPool = Executors.newFixedThreadPool(10);
    Client client=new Client("localhost",2881);
    @Test
    public  void test1() {
      //Client client=new Client("localhost",2881);
      while(true){
          client.sendMsg("我是客户端1");
      }

    }
    @Test
    public  void test2() {

        threadPool.execute(client);
        Scanner scanner = new Scanner(System.in);

        try {
            Thread.sleep(2000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("请输入…………");
        for(int i=1;i<11;i++){
            client.sendMsg(i+"");
        }
    }
    private boolean sendMsg(String s){
        client.sendMsg(s);
        return true;
    }
}
